<?php
/**
* Ring Delete
* @author: trungdt
* @since: Jan 25, 2011
* @version: 1.0
* 
* Change logs
* Jan 26, 2011 - first create
*/

if (!defined('EXPONENT')) exit('');

$rings = null;
if (isset($_GET['id'])) {
	$rings = $db->selectObject('pray_ring','id='.intval($_GET['id']));
}

if ($rings) {
	//$loc = unserialize($question->location_data);
	//if (exponent_permissions_check('manage_question',$loc)) {
    if (exponent_users_isAdmin() && exponent_users_isLoggedIn()){
		/**
        * WARNING: MUST REMOVE ALL RELATIVE items
        */
        //$db->delete('poll_answer','question_id='.$question->id);
		$db->delete('pastor_ring','ring_id = '.$rings->id);
        $db->delete("pray_ring","id = {$rings->id}");
		exponent_flow_redirect();
	} else {
		echo SITE_403_HTML;
	}
} else {
	echo SITE_404_HTML;
}

?> 
